﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using _MetalSlug.Mission;
using Microsoft.Xna.Framework.Input;
using _MetalSlug.MyCharacters.Characters;

namespace _MetalSlug.MyUtilities
{
    public class MyPivot
    {
        //public const float DistanceToMove = 
        float pivotPoint;
        public float PivotPoint
        {
            get { return pivotPoint; }
        }

        float distanceToMove;
        public float DistanceToMove
        {
            get { return distanceToMove; }
            set { distanceToMove = value; }
        }

        public MyPivot()
        {
            pivotPoint = 0;
        }

        public void Update(MyMap Map, MyCharacter Hero)
        {
            if (UserInput.CurrentKeyBoard.IsKeyDown(Keys.D))
            {
                if(Hero.TopLeft.X - PivotPoint< DistanceToMove)
                {
                    return;
                }

                if (PivotPoint + Hero.CurrentSpeed <= Map.Size.X - GameUtil.ScreenSize.X)
                {
                    pivotPoint += Hero.CurrentSpeed;
                }
            }
        }

        public void SetPivotPoint(float point)
        {
            pivotPoint = point;
        }
    }
}
